// This calculator will get input from two banks
// and will calculate the monthly payments 
// it will also give feedback to which bank is better and 
// annual savings 
// THIS IS THE ONLY CALCULATOR YOU WILL NEED WHEN BUYING CAR. TRUST ME :) 
// Reserved to Sumbatashvili and if you use it please transfer me lots of money....  
#include <iostream>
#include <cmath>


using namespace std; 

int autocalcone (int loanOne) 
{
	double loanAmount;
	double rate; 
	double time; 
	
	cout << "Bank Of America"<< endl; 
	cout << "Please Enter Loan Amount: "; 
	cin >> loanAmount; 
	cout <<endl;
	cout << "Please Enter Rete: "; 
	cin >> rate; 
	cout <<endl;
	cout << "Please Enter the Number of Month (Ex. 5 years = 60 month) : "; 
	cin >> time; 
	cout <<endl;
	
	loanOne =((loanAmount*(rate/12))/(1-1/pow((1+rate/12) , time)));  
	
	return loanOne; 
	
}
int autocalctwo (int loanTwo) 
{
	double loanAmount;
	double rate; 
	double time; 
	
	cout << "Chase Auto Loan"<< endl; 
	cout << "Please Enter Loan Amount:  "; 
	cin >> loanAmount; 
	cout <<endl;
	cout << "Please Enter Rete (Ex. 5% 0.05):  "; 
	cin >> rate; 
	cout <<endl;
	cout << "Please Enter the Number of Month (Ex. 5 years = 60 month) : "; 
	cin >> time; 
	cout <<endl;
	
	loanTwo =((loanAmount*(rate/12))/(1-1/pow((1+rate/12) , time))); // (P x (i / 12)) / (1 - (1 + i / 12)-n)  
	
	return loanTwo; 
	
}

void autoLoanComparissonCalculator () 

{
	int loanOne=0;
	int loanTwo=0;
	double monthlyPayment1;
	double monthlyPayment2;

	monthlyPayment1 = autocalcone (loanOne);

cout << "Bank Of America Monthly payment Amount is:  " << monthlyPayment1 << endl;


	monthlyPayment2 = autocalctwo (loanTwo);


	
	cout << "Chase Bank Loan Amount is:  " << monthlyPayment2 << endl; 

	if (monthlyPayment2 > monthlyPayment1 )
	{
	cout <<"Bank Of America Has better Rate"<< endl; 
	cout <<"You will be able to save $" << (monthlyPayment2 - monthlyPayment1)*60 << " with Bank Of America" << endl; 
	}
	else 
	{
	cout <<"Chase Has better Rate"<< endl;
	cout <<"You will be able to save $" << (monthlyPayment1 - monthlyPayment2)*60 << " with Chase Bank" << endl;  
	}
	
	
	system ("PAUSE"); 
}